import { type APIRoute } from "astro"; import { createInboxAttachmentResponse, getInboxAttachment, } from "../../../../core/index.js"; import { getWebProjectContext } from "../../../../web/projects.js"; export const GET: APIRoute = async ({ params, url }) => { if (!params.id || !params.filename) { return new Response("Not found", { status: 404 }); } try { const context = await getWebProjectContext(url); const attachment = await getInboxAttachment( params.id, params.filename, context.project.root, ); return await createInboxAttachmentResponse(attachment); } catch { return new Response("Not found", { status: 404 }); } };